<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery.js"></script>
<script src="js/pintuer.js"></script>
</head>
<body>
<form method="post" action="" id="listform">
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong> <a onclick="xg()" style="float:right; display:none;">全部发布成绩</a></div>
    <div class="padding border-bottom">
      <ul class="search" style="padding-left:10px;">
        <li> <a class="button border-main icon-plus-square-o" onclick="xg()"> 全部发布成绩</a> </li>
      </ul>
    </div>
    <table class="table table-hover text-center">
      <tr>
          <th width="100" style="text-align:left; padding-left:20px;">主键ID</th>
          <th width="10%">学号</th>
          <th>课程id</th>
          <th>老师id</th>
          <th>成绩规则ID</th>
          <th>平时成绩</th>
          <th>期中成绩</th>
          <th>期末成绩</th>
          <th>技能成绩</th>
          <th>总成绩</th>
          <th>是否及格</th>
          <th>发布</th>
          <th>备注</th>
          <th width="310">操作</th>
      </tr>
        <tbody class="student-list">

        </tbody>
      <volist name="list" id="vo">
		<tr>
			<td colspan="8">
				<div class="pagelist">
					<a href="">上一页</a>
					<span class="current">1</span>
					<a href="">2</a>
					<a href="">3</a>
					<a href="">下一页</a>
					<a href="">尾页</a>
				</div>
			</td>
		 </tr>
    </table>
  </div>
</form>
<script src="js/jquery.min.js"></script>
<script type="text/javascript">
    $(function(){
        var tno = localStorage.getItem("supervisetno1");
        $.ajax({
            type:"POST",
            url:"/workview/performancetno",
            datatype:'json',
            data:({
                tno: tno
            }),
            success:function(data){
                if(data.status==401){
                    alert("熔断开启，系统异常");
                    window.location.href="login.html";
                    return;
                }
                var  lists = data.data;
                console.log(data);
                for (var i = 0; i < lists.length; i++){
                    var html = "";
                    html +=`
                        <tr>
                        <td style='text-align:left; padding-left:20px;'>${lists[i].performance_id}</td>
                         <td>${lists[i].sno}</td>
                        <td>${lists[i].elective_course_id}</td>
                        <td>${lists[i].tno}</td>
                        <td>${lists[i].performance_rule_id}</td>
                        <td>${lists[i].peacetime_performance}</td>
                        <td>${lists[i].mid_term_performance}</td>
                        <td>${lists[i].final_performance}</td>
                        <td>${lists[i].skill_assessment}</td>
                        <td>${lists[i].total_score}</td>
                        <td>${lists[i].pass_flag}</td>
                        <td>${lists[i].allow_flag}</td>
                        <td>${lists[i].remark}</td>
                            <td>
                                <div class="button-group">
                                    <a onclick="check1('${lists[i].performance_id}')" class="button border-main" ><span class="icon-edit"></span> 修改</a>
                                </div>
                             </td>
                         </tr>
                        `

                    $('.student-list').append(html);
                }
            }
        })
    })
     function check1(sn){
        console.log(sn);
		 localStorage.setItem("performance_id",sn);
         window.location.href="tperformanceup.html";
    }
    function xg(){
        var tno = localStorage.getItem("supervisetno1");
        var allow_flag = 1;
        $.ajax({
            type:"POST",
            url:"/workview/allow_flagfabu",
            data:({
                tno:tno,
                allow_flag:allow_flag
            }),
            success:function(data){
                console.log(data);
                if(data.status==401){
                    alert("熔断开启，系统异常");
                    window.location.href="slogin.html";
                    return;
                }
                if(data.status==200) {
                    alert("成功")
                    window.location.href="tnoperformancelist.html";
                    return;
                }
                if(data.status==500) {
                    alert("失败");
                    window.location.href="tnoperformancelist.html";
                    return;
                }
                if(data.status==null) {
                    alert("异常");
                    window.location.href="tnoperformancelist.html";
                    return;
                }
            },
            error:function(XMLHttpRequest,textStatus) {
                if (textStatus === 'timeout') {
                    alert('請求超時');
                    setTimeout(function () {
                        alert('重新请求');
                    }, 2000);
                }
                window.location.href="tnoperformancelist.html";
            }

        });
    }
//单个删除
function del(sn){
	if(confirm("您确定要删除吗?")){
        $.ajax({
            type:"POST",
            url:"/workview1/delStudent",
            data:({
                sno:sn
            }),
            success:function(data){
                console.log(data);
                if(data.status==401){
                    alert("熔断开启，系统异常");
                    window.location.href="slogin.html";
                    return;
                }
                if(data.status==200) {
                    alert("成功")
                    window.location.href="studentlist.html";
                    return;
                }
                if(data.status==500) {
                    alert("失败");
                    window.location.href="studentlist.html";
                    return;
                }
                if(data.status==null) {
                    alert("异常");
                    window.location.href="studentlist.html";
                    return;
                }
            },
            error:function(XMLHttpRequest,textStatus) {
                if (textStatus === 'timeout') {
                    alert('請求超時');
                    setTimeout(function () {
                        alert('重新请求');
                    }, 2000);
                }
                window.location.href="studentlist.html";
            }

        });
		
	}
}

//全选
$("#checkall").click(function(){ 
  $("input[name='id[]']").each(function(){
	  if (this.checked) {
		  this.checked = false;
	  }
	  else {
		  this.checked = true;
	  }
  });
})

//批量删除
function DelSelect(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		var t=confirm("您确认要删除选中的内容吗？");
		if (t==false) return false;		
		$("#listform").submit();		
	}
	else{
		alert("请选择您要删除的内容!");
		return false;
	}
}

//批量排序
function sorts(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){	
		
		$("#listform").submit();		
	}
	else{
		alert("请选择要操作的内容!");
		return false;
	}
}


//批量首页显示
function changeishome(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		
		$("#listform").submit();	
	}
	else{
		alert("请选择要操作的内容!");		
	
		return false;
	}
}

//批量推荐
function changeisvouch(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		
		
		$("#listform").submit();	
	}
	else{
		alert("请选择要操作的内容!");	
		
		return false;
	}
}

//批量置顶
function changeistop(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){		
		
		$("#listform").submit();	
	}
	else{
		alert("请选择要操作的内容!");		
	
		return false;
	}
}


//批量移动
function changecate(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){		
		
		$("#listform").submit();		
	}
	else{
		alert("请选择要操作的内容!");
		
		return false;
	}
}

//批量复制
function changecopy(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){	
		var i = 0;
	    $("input[name='id[]']").each(function(){
	  		if (this.checked==true) {
				i++;
			}		
	    });
		if(i>1){ 
	    	alert("只能选择一条信息!");
			$(o).find("option:first").prop("selected","selected");
		}else{
		
			$("#listform").submit();		
		}	
	}
	else{
		alert("请选择要复制的内容!");
		$(o).find("option:first").prop("selected","selected");
		return false;
	}
}

</script>
</body>
</html>